package com.foruo.learn.designmode.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 组织机构
 * @author GaoYuan
 */
public class Organization {

    private String id;
    private String name;
    /** 子组织机构列表 关键属性 */
    private List<Organization> organizationList;

    public Organization(String id,String name){
        this.id = id;
        this.name = name;
        organizationList = new ArrayList<>();
    }

    public List<Organization> getOrganizationList() {
        return organizationList;
    }

    /** 添加 关键点 */
    public void add(Organization organization){
        organizationList.add(organization);
    }
    /** 删除 关键点 */
    public void remove(Organization organization){
        organizationList.remove(organization);
    }

    @Override
    public String toString() {
        return "Organization{" +
                "id='" + id + '\'' +
                ", name='" + name +
                '}';
    }
}
